#include <fstream>
#include <iostream>
#include "bigInteger.h"
#include "bigIntegerPtr.h"

using namespace std;
const int MAX_LENGTH = 500;

int main()
{	
	//$$$$$$$$$$ POINTER TEST
	
	BigInteger *  num1 = new BigInteger(123);
	BigIntegerPtr numPtr1(num1);

	BigInteger *  num2 = new BigInteger(13);
	BigIntegerPtr numPtr2(num2);

	std::cout << "Smart Pointer test: val1:     "<<(char*)(*num1) << std::endl;
	std::cout << "Smart Pointer test: ptr1:     "<<(char*)(*numPtr1) << std::endl;
	std::cout << "Smart Pointer test: val1:     "<<(char*)(*num2) << std::endl;
	std::cout << "Smart Pointer test: ptr1:     "<<(char*)(*numPtr2) << std::endl;
	std::cout << "Smart Pointer test: compare 2 smartpointers:     " << (numPtr1 < numPtr2) << std::endl;
	std::cout << "Smart Pointer test: compare smartpointer & pointer:     " << (numPtr2 == num2) << std::endl;

	numPtr2 = num1;

	std::cout << "Smart Pointer test: ptr2 = val1; ptr2: "<<(char*)(*numPtr2) << std::endl;
	
	//$$$$$$$$$$ POINTER TEST

	ifstream input("input.txt");
	ofstream output("output.txt");
	
	int n = 0;
	input >> n;
	
	
	for(int i = 0; i !=n; ++i){
		char a[MAX_LENGTH];
		char b[MAX_LENGTH];

		char operation;

		input >> a;
		input >> operation;
		input >> b;
		
		BigInteger bigA(a);
		BigInteger bigB(b);
		BigInteger result;
		
		if(operation == '+')
		{			
			result = bigA + bigB;	
		}

		if(operation == '-')
		{			
			result = bigA - bigB;	
		}

		if(operation == '*')
		{			
			result = bigA * bigB;	
		}
					
		if(result.getSign() < 0)
			output << '-';
		output << (char*)result<< endl;
		
	}//for		
	return 0;


}//main

